import React, { useState, useEffect } from 'react'
import { View, Image } from '@tarojs/components'
import { AtList, AtListItem , AtButton,AtToast } from "taro-ui"
import Taro from '@tarojs/taro'
import Info from './info'
import Concat from './concat'
import Intro from './intro'
import GetCard from './getCard'
import ToLogin from '../../compontents/toLogin'
import api from '../../http/api'


import './index.less'
import "taro-ui/dist/style/components/list.scss";
import "taro-ui/dist/style/components/icon.scss";
import "taro-ui/dist/style/components/modal.scss";
import "taro-ui/dist/style/components/button.scss";
import "taro-ui/dist/style/components/toast.scss";


export default (props: any) => {
  const id:any = props.tid.split('id=')[1].split('&')[0]
  const [data,setData] = useState({})
  useEffect(()=>{
    api.businessDetail({
      id:id,
    }).then((res:any)=>{
      const _data =  res.data
      _data.content = _data.content.replace(/<img/g,"<img style='width:100%'")
      setData(_data)
    })
  },[])
  return (
    <View className='businessDetail'>
      <ToLogin url='/pages/businessDetail/index'></ToLogin>
      <Info data={data}/>
      <Concat data={data}/>
      <Intro data={data}/>
      <GetCard data={data}/>
    </View>
  )
}
